/**
 *@program: getx_simple_code
 *@description:
 *@author: Ming
 *@create: 2023-12-27 15:04
 *@version v1.0
 */

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_simple_code/common/middleware/router_auth.dart';
import 'package:getx_simple_code/common/routes/observers.dart';
import 'package:getx_simple_code/pages/baseFun/index.dart';
import 'package:getx_simple_code/pages/diovc/binding.dart';
import 'package:getx_simple_code/pages/diovc/view.dart';
import 'package:getx_simple_code/pages/diovcdetail/binding.dart';
import 'package:getx_simple_code/pages/diovcdetail/view.dart';
import 'package:getx_simple_code/pages/getxVc/binding.dart';
import 'package:getx_simple_code/pages/getxVc/view.dart';
import 'package:getx_simple_code/pages/getxmvc/binding.dart';
import 'package:getx_simple_code/pages/getxmvc/view.dart';
import 'package:getx_simple_code/pages/home/index.dart';
import 'package:getx_simple_code/pages/lang/index.dart';
import 'package:getx_simple_code/pages/list/index.dart';
import 'package:getx_simple_code/pages/list_detail/index.dart';
import 'package:getx_simple_code/pages/login/index.dart';
import 'package:getx_simple_code/pages/my/index.dart';
import 'package:getx_simple_code/pages/notfound/index.dart';
import 'package:getx_simple_code/pages/obx/index.dart';
import 'package:getx_simple_code/pages/refresh/binding.dart';
import 'package:getx_simple_code/pages/refresh/view.dart';
import 'package:getx_simple_code/pages/router/index.dart';
import 'routes.dart';

// part 'app_routes.dart';

class AppPages {
  static const INITIAL = AppRoutes.Home;
  static final RouteObserver<Route> observer = RouteObservers();
  static List<String> history = [];
  //404
  static final unknownRoute = GetPage(
    name: AppRoutes.NotFound,
    page: () => NotfoundView(),
  );
  //路由
  static final routes = [
    GetPage(
      name: AppRoutes.Home,
      page: () => HomeView(),
    ),
    GetPage(
      name: AppRoutes.List,
      page: () => listWidget(),
      children: [
        GetPage(
          name: AppRoutes.Detail,
          page: () => DetailView(),
        ),
        GetPage(
          name: AppRoutes.Detail_ID,//占位路由
          page: () => DetailView(),
          // transition: Transition.upToDown,
        ),
      ],
    ),
    GetPage(
      name: AppRoutes.Login,
      page: () => LoginView(),
    ),
    GetPage(
      name: AppRoutes.My,
      page: () => MyView(),
      middlewares: [
        RouteAuthMiddleware(priority: 1)
      ],
    ),
    GetPage(
      name: AppRoutes.Router,
      page: () => RouterView(),
    ),
    GetPage(
      name: AppRoutes.Obx,
      page: () => ObxView(),
    ),
    GetPage(
      name: AppRoutes.BaseFun,
      page: () => BaseFunView(),
    ),
    // 多语言
    GetPage(
        name: AppRoutes.Lang,
        page: () => LangView()
    ),
    // GetBuilder使用
    GetPage(
        name: AppRoutes.GetxVC,
        page: () => GetxVcPage(),
        binding: GetxVcBinding(),
    ),
    GetPage(
      name: AppRoutes.GetxmVC,
      page: () => GetxmvcPage(),
      binding: GetxmvcBinding(),
      // bindings: [GetxmvcBinding(),GetxVcBinding()],
    ),
    GetPage(
      name: AppRoutes.Diovc,
      page: () => DiovcPage(),
      binding: DiovcBinding(),
      children: [
        GetPage(
          name: AppRoutes.DiovcDetail,
          page: () => DiovcdetailPage(),
          binding: DiovcdetailBinding(),
        ),
      ]
    ),
    GetPage(
      name: AppRoutes.RefreshPage,
      page: () => RefreshPage(),
      binding: RefreshBinding(),
    ),
  ];
}